package entity;

import static java.util.Objects.hash;

/**
 * @description:
 * @author: Lidong
 * @time: 2020/7/29 19:47
 **/
public class People {

    private int id;
    private String name;
    private int age;


    public People(int id,String name,int age){
        this.id=id;
        this.age=age;
        this.name=name;
    }

    public People() {

    }


    public void setId(int id){
        this.id=id;
    }

    public int getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    /**
     * 重写toString 方法
     */
    @Override
    public String toString(){
        return "People{id:"+id+",age:"+age+",name:"+name+"}";
    }

    /**
     * 重写equlas
     */
    @Override
    public boolean equals(Object object){
        if(this==object) {
            return true;
        }
        if(object==null || object.getClass()!=getClass()){
            return false;
        }
        People people= (People) object;
        return id==people.id && name.equals(people.name) && age==people.age;
    }

    /**
     * 重写hashCode方法
     */
    @Override
    public int hashCode(){
        int hash = hash(id, name, age);
        return hash;
    }

}
